package om.wsch.test.runindex;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import org.apache.commons.lang.RandomStringUtils;

import com.wsch.client.WschClient;

public class RunTestData {

	public static void main(String[] args) {
		WschClient client = new WschClient("http://127.0.0.1:8280/wsch", "F59BD65F7EDAFB087A81D4DCA06C4910", "apiuser",
				"111111");
		System.out.println(client.isLive(false));

		String projectid = "2c948a837f2f1131017f2f4594330002";

		for (int m =457251; m < 500000;) {
			String no = UUID.randomUUID().toString().replace("-","");
			for (int n = 1; n < 1000; n++) {
				// APPID : StringField 业务ID,
				// TITLE : TextField 标题,
				// APPKEYID : StringField 业务KEYID,
				// CONTENT : TextField 正文,
				// POPKEYS : StringField 权限KEY,
				Map<String, String> map = new HashMap<String, String>();
				map.put("APPID", String.valueOf(m));
				map.put("TITLE", RandomStringUtils.random(10, 0x4e00, 0x9fa5, false, false));
				map.put("APPKEYID", "TEST");
				map.put("CONTENT", RandomStringUtils.random(1000, 0x4e00, 0x9fa5, false, false));
				map.put("POPKEYS", String.valueOf(n % 10));
				client.addIndex(projectid, no, map);
				System.out.println("POPKEYS:"+map.get("POPKEYS"));
				System.out.println("载入索引"+m);;
				m++;
			}
			client.runIndex(projectid, no);
			System.out.println("执行索引"+"批次:"+no+",当前索引:"+m);;
		}
	}

}
